<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/includes/common-import.jsp"%>
<%@ taglib uri="/page" prefix="p"%>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8" />
	<title>后台管理系统</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<%@ include file="/WEB-INF/includes/common-component-list.jsp"%>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN HEADER -->
	<%@ include file="/WEB-INF/includes/header.jsp"%>
	<!-- END HEADER -->
	<!-- BEGIN CONTAINER -->
	<div class="page-container row-fluid">
		<!-- BEGIN SIDEBAR -->
		<%@ include file="/WEB-INF/includes/leftMenu.jsp"%>
		<!-- END SIDEBAR -->
		<!-- BEGIN PAGE -->
		<div class="page-content">
			<!-- BEGIN PAGE CONTAINER-->        
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">
							用户管理
							 <small>操作员维护</small>
						</h3>
						<!-- END PAGE TITLE & BREADCRUMB-->
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div class="row-fluid">
					<div class="span12">
						<form id="searchForm" class="form-horizontal" action="${basePath }system/user">
							<div class="portlet">
								<div class="portlet-title">
									<div class="input-prepend input-append">
										<span class="add-on"><i class="icon-search"></i></span>
										<input class="m-wrap placeholder-no-fix" type="text" 
											placeholder="按账号查询..." id="loginName" name="map['loginName']" value="${searchParams.map['loginName'] }"/>
										<button type="submit" class="btn green pull-right" >查询</button> 
									</div>
								</div>
							</div>
						</form>
						<div class="alert alert-success ${empty MESSAGE ?'hide':'' }">
							<button class="close" data-dismiss="alert"></button>
							<span>${MESSAGE }</span>
						</div>
						<!-- BEGIN EXAMPLE TABLE PORTLET-->
						<div class="portlet box light-grey">
							<div class="clearfix">
									<div class="btn-group">
										<a id="sample_editable_1_new" class="btn green" href="${basePath }system/user/create">
											新增 <i class="icon-plus"></i>
										</a>
									</div>
								</div>
								<table class="table table-striped table-bordered table-hover" id="sample_1">
									<thead>
										<tr>
											<th style="width:40px;">序号</th>
											<th>账号</th>
											<th>姓名</th>
											<th>角色</th>
											<th class="hidden-480">Email</th>
											<th class="hidden-480">联系电话</th>
											<c:if test="${sessionScope['LOGIN_USER'].sysRole.id==-1 }">
												<th ></th>
											</c:if>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${list}" var="list" varStatus="status">
											<tr class="odd gradeX">
												<td>${status.index+1 }</td>
												<td>${list.loginName }</td>
												<td>${list.trueName }</td>
												<td>${list.sysRole.roleName }</td>
												<td class="hidden-480"><a href="mailto:${list.email }">${list.email }</a></td>
												<td class="hidden-480">${list.telephone }</td>
												<c:if test="${sessionScope['LOGIN_USER'].sysRole.id==-1 }">
													<td >
														<a class="edit" href="${basePath}system/user/update/${list.id}">编辑</a>&nbsp;
														<a class="edit" onclick="theDel(${list.id})" href="javascript:void();">删除</a>
													</td>
												</c:if>
											</tr>
										</c:forEach>
									</tbody>
								</table>
								<p:page url="user" cpage="${page.cpage }" perItem="${page.perItem }" totalItem="${page.totalItem }"/>
						</div>
						<!-- END EXAMPLE TABLE PORTLET-->
					</div>
				</div>
			</div>
			<!-- END PAGE CONTAINER-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
</body>
<script type="text/javascript">
	function setRole(userId){
		var url = "${basePath}system/sysUserRole/setUserRole/"+userId;
		$.dialog({
			width : '550px',
			height : '450px',
			title : '用户授权',
			max : false,
			min : false,
			content : 'url:' + url
		});
	}
	function theDel(id){
		if(confirm("您确认要进行删除操作吗？")){
			var url = "${basePath}system/user/delete/" + id;
			window.location=url;
		}
	}
</script>
<!-- END BODY -->
</html>